package com.example.check;

import com.example.check.validator.SexConstraintValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 性别约束
 * Constraint注解中填校验规则
 */
@Target({ ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = SexConstraintValidator.class)
public @interface Sex {
    /*校验信息*/
    String message() default "性别有误";
    /*是否分组*/
    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };
}
